package com.glory.dgcpcpda.adapter;

import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.dgcpcpda.R;
import com.glory.dgcpcpda.base.MyApp;
import com.glory.dgcpcpda.entity.EqpKeepListBean;

import java.util.List;

import androidx.annotation.Nullable;

public class EqpKeepListAdapter extends BaseQuickAdapter<EqpKeepListBean, BaseViewHolder> {

    public EqpKeepListAdapter(@Nullable List<EqpKeepListBean> data) {
        super(R.layout.adapter_param_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, EqpKeepListBean item) {
        switch (item.getStatus()) {
            case "CREATE"://创建
                helper.setText(R.id.tvItem3, "创建");
                helper.setTextColor(R.id.tvItem1, MyApp.app.getResources().getColor(R.color.blue));
                helper.setTextColor(R.id.tvItem2, MyApp.app.getResources().getColor(R.color.blue));
                helper.setTextColor(R.id.tvItem3, MyApp.app.getResources().getColor(R.color.blue));
                helper.setTextColor(R.id.tvItem4, MyApp.app.getResources().getColor(R.color.blue));
                helper.setTextColor(R.id.tvItem5, MyApp.app.getResources().getColor(R.color.blue));
                break;
            case "START"://已开始
                helper.setText(R.id.tvItem3, "开始");
                helper.setTextColor(R.id.tvItem1, MyApp.app.getResources().getColor(R.color.green));
                helper.setTextColor(R.id.tvItem2, MyApp.app.getResources().getColor(R.color.green));
                helper.setTextColor(R.id.tvItem3, MyApp.app.getResources().getColor(R.color.green));
                helper.setTextColor(R.id.tvItem4, MyApp.app.getResources().getColor(R.color.green));
                helper.setTextColor(R.id.tvItem5, MyApp.app.getResources().getColor(R.color.green));
                break;
            case "CANSTART"://可以开始
                helper.setText(R.id.tvItem3, "可以开始");
                helper.setTextColor(R.id.tvItem1, MyApp.app.getResources().getColor(R.color.free_ui_deep_green));
                helper.setTextColor(R.id.tvItem2, MyApp.app.getResources().getColor(R.color.free_ui_deep_green));
                helper.setTextColor(R.id.tvItem3, MyApp.app.getResources().getColor(R.color.free_ui_deep_green));
                helper.setTextColor(R.id.tvItem4, MyApp.app.getResources().getColor(R.color.free_ui_deep_green));
                helper.setTextColor(R.id.tvItem5, MyApp.app.getResources().getColor(R.color.free_ui_deep_green));
                break;
            case "FORM"://已临时保存
                helper.setText(R.id.tvItem3, "临时保存");
                helper.setTextColor(R.id.tvItem1, MyApp.app.getResources().getColor(R.color.orange));
                helper.setTextColor(R.id.tvItem2, MyApp.app.getResources().getColor(R.color.orange));
                helper.setTextColor(R.id.tvItem3, MyApp.app.getResources().getColor(R.color.orange));
                helper.setTextColor(R.id.tvItem4, MyApp.app.getResources().getColor(R.color.orange));
                helper.setTextColor(R.id.tvItem5, MyApp.app.getResources().getColor(R.color.orange));
                break;
            case "COMPLETE"://已完成
                helper.setText(R.id.tvItem3, "已完成");
                helper.setTextColor(R.id.tvItem1, MyApp.app.getResources().getColor(R.color.free_ui_yellow_theme_color));
                helper.setTextColor(R.id.tvItem2, MyApp.app.getResources().getColor(R.color.free_ui_yellow_theme_color));
                helper.setTextColor(R.id.tvItem3, MyApp.app.getResources().getColor(R.color.free_ui_yellow_theme_color));
                helper.setTextColor(R.id.tvItem4, MyApp.app.getResources().getColor(R.color.free_ui_yellow_theme_color));
                helper.setTextColor(R.id.tvItem5, MyApp.app.getResources().getColor(R.color.free_ui_yellow_theme_color));
                break;
            case "WARNING"://警告
                helper.setText(R.id.tvItem3, "警告");
                helper.setTextColor(R.id.tvItem1, Color.argb(255, 255, 182, 193));
                helper.setTextColor(R.id.tvItem2, Color.argb(255, 255, 182, 193));
                helper.setTextColor(R.id.tvItem3, Color.argb(255, 255, 182, 193));
                helper.setTextColor(R.id.tvItem4, Color.argb(255, 255, 182, 193));
                helper.setTextColor(R.id.tvItem5, Color.argb(255, 255, 182, 193));
                break;
            case "QC"://qc
                helper.setText(R.id.tvItem3, "QC");
                helper.setTextColor(R.id.tvItem1, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem2, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem3, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem4, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem5, MyApp.app.getResources().getColor(R.color.red));
                break;
            case "TIMEOUT":
                helper.setText(R.id.tvItem3, "超时");
                helper.setTextColor(R.id.tvItem1, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem2, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem3, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem4, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem5, MyApp.app.getResources().getColor(R.color.red));
                break;
            default:
                helper.setTextColor(R.id.tvItem1, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem2, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem3, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem4, MyApp.app.getResources().getColor(R.color.red));
                helper.setTextColor(R.id.tvItem5, MyApp.app.getResources().getColor(R.color.red));
                break;
        }

        helper.setText(R.id.tvItem1, item.getSheetName());
        helper.setText(R.id.tvItem2, item.getPeriodId());
        helper.setText(R.id.tvItem4, item.getScheduleDate());
        helper.setText(R.id.tvItem5, item.getEquipmentId());
//        helper.setGone(R.id.tvItem5, false);
    }


}
